package com.ruoyi.novel.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.novel.mapper.SearchMapper;
import com.ruoyi.novel.domain.Search;
import com.ruoyi.novel.service.ISearchService;

/**
 * 搜索记录Service业务层处理
 *
 * @author 张三
 * @date 2025-04-28
 */
@Service
public class SearchServiceImpl extends ServiceImpl<SearchMapper, Search> implements ISearchService
{
    @Autowired
    private SearchMapper searchMapper;

    /**
     * 查询搜索记录
     *
     * @param id 搜索记录主键
     * @return 搜索记录
     */
    @Override
    public Search selectSearchById(Integer id)
    {
        return searchMapper.selectSearchById(id);
    }

    /**
     * 查询搜索记录列表
     *
     * @param search 搜索记录
     * @return 搜索记录
     */
    @Override
    public List<Search> selectSearchList(Search search)
    {
        return searchMapper.selectSearchList(search);
    }

    /**
     * 新增搜索记录
     *
     * @param search 搜索记录
     * @return 结果
     */
    @Override
    public int insertSearch(Search search)
    {
        search.setCreateTime(DateUtils.getNowDate());
        return searchMapper.insertSearch(search);
    }

    /**
     * 修改搜索记录
     *
     * @param search 搜索记录
     * @return 结果
     */
    @Override
    public int updateSearch(Search search)
    {
        search.setUpdateTime(DateUtils.getNowDate());
        return searchMapper.updateSearch(search);
    }

    /**
     * 批量删除搜索记录
     *
     * @param ids 需要删除的搜索记录主键
     * @return 结果
     */
    @Override
    public int deleteSearchByIds(Integer[] ids)
    {
        return searchMapper.deleteSearchByIds(ids);
    }

    /**
     * 删除搜索记录信息
     *
     * @param id 搜索记录主键
     * @return 结果
     */
    @Override
    public int deleteSearchById(Integer id)
    {
        return searchMapper.deleteSearchById(id);
    }
}
